import axios from './axios-config';
import {base_url} from "../constant/baseConstant";

//登录请求
export const login = (user) => axios.post(`${base_url}admin/login`, user)
//注册请求
export const register = (userInfo) => axios.post(`${base_url}admin/register`, userInfo)
//判断是否登录
export const isLogin = () => axios.get(`${base_url}admin/test`)
//获取列表数据
export const getTodosApi = (pageInfo) => axios.post(`${base_url}todoInfo/page`, pageInfo)
//修改todo状态
export const updateStatusApi = (todo) => axios.put(`${base_url}todoInfo/`, todo)
//修改todo的内容
export const updateContentApi = (todo) => axios.post(`${base_url}todoInfo/updateContent`, todo)
//新增一条todo
export const addTodoApi = (todo) => axios.post(`${base_url}todoInfo/`, todo)
//获取用户信息
export const getUserInfoApi = () => axios.get(`${base_url}admin/getAdminInfo`)
//修改用户信息
export const modifyAdminInfoApi = (user) => axios.post(`${base_url}admin/modifyAdminInfo`, user)
//检查旧密码是否正确
export const checkPasswordApi = (password) => axios.post(`${base_url}admin/checkPassword`, password)
//修改密码
export const updatePasswordApi = (password) => axios.post(`${base_url}admin/updatePassword`, password)
//删除所有已完成
export const deleteAllCancelApi = () => axios.get(`${base_url}todoInfo/deleteAllCancel`)

export const isLoginData = () => {
    let data = '123'
    axios.get(`${base_url}admin/test`).then(
        response => {
            return response.data
        }
    )
}
